package com.net.tomcat5.Servlet2;
import java.util.Map;

/**
 * Administrator
 *
 * @author jiangbang
 * @date 2016/8/25
 */
public class WebApp {
    private static ServletContext context;
    static{
        context = new ServletContext();
        Map<String,String> mapping = context.getMapping();
        mapping.put("/login","login");
        mapping.put("/log","log");
        mapping.put("/reg","register");

        Map<String,Servlet> servlet = context.getServlet();
        servlet.put("login",new LoginServlet());
        servlet.put("register",new RigisterServlet());
    }

    public static Servlet getServlet(String url){
        if(null==url || url.equals("")){
            return  null;
        }
        return context.getServlet().get(context.getMapping().get(url));
    }


}
